﻿#if !Profile && ALLOC
using System;
using System.Diagnostics;
using O1.Kernel.Storage;
using O1.Kernel.Primitives;

namespace O1.Profiling
{
    class Program
    {
        private const int size = 1024 * 1024;// * 100;

        static void Main(string[] args)
        {
            var bytesAllocated = GC.GetTotalMemory(true);
            var storage2 = new MultiVersionBinaryArray(size);
            var difference = GC.GetTotalMemory(true) - bytesAllocated;
            Console.WriteLine("Allocated " + storage2.Length + " sized empty array.");
            Console.WriteLine("Overhead: " + difference + " bytes");
            Console.WriteLine("Bytes per cell overhead: " + difference / size);
            Console.ReadLine();
            storage2 = null;
            var timer = Stopwatch.StartNew();
            GC.Collect(2, GCCollectionMode.Forced, true);
            timer.Stop();
            Console.WriteLine("Garbage collected in {0} ms", timer.ElapsedMilliseconds);
            Console.ReadLine();
        }
    }
}
#endif